<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui" 
	template="/templates/layout.xhtml">
	<ui:define name="head">    
	<style type="text/css">
	    .ui-diagram-element {   
	        width:6em; 
	        height:4em;     
	        line-height:4em;
	        font-size: 16px;
	        font-weight: bold;
	        text-align: center;
	        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.8);
	        border-radius: 4em;
	        border: 1px solid transparent;
	        background-color: #40E0D0;
	        color: #ffffff;
	    }
	    .ui-diagram-element:hover {
	        background-color: #D3D3D3;
	    }
	    
	    .flow-label {
	        font-size: 15px;
	        color: #816A51;
	    }
	    .ui-diagram-start {
			background-color: #8B0000;
			color: #ffffff;
			border-color: #7ab02c;
		}
		.ui-diagram-end {
			background-color: #8B0000;
			color: #ffffff;
			border-color: #7ab02c;
		}	 
		 .ui-diagram-focus {
			background-color: #00db00;
			font-weight: bold;
			color: blue;
			border-color: #00db00;
		}
	    .ui-diagram-success {
	        background-color: #9CB071;
	        color: #ffffff;
	        border-color: #7ab02c;
	    }	 
	    .ui-diagram-fail {
	        background-color: #C34A2C;
	        color: #ffffff;
	    }
	</style>
	</ui:define>
	<ui:define name="ptitle">我的工作</ui:define>
	<ui:define name="pcontent">
	
	<h:form id="wfmTaskFrm">
		<p:growl id="msgs" showDetail="true" />		
		<h:panelGrid columns="4" cellspacing="10">	
			<p:outputLabel value="业务编号："></p:outputLabel>
			<p:inputText value="#{wfmTaskMgrMB.serviceNo}"></p:inputText>
			<p:commandButton value="查询" icon="ui-icon-search"
				action="#{wfmTaskMgrMB.queryTaskList}"
				update=":wfmTaskFrm:dtTask" >
				<f:setPropertyActionListener value="#{appShiroValidate.userno}"
					target="#{wfmTaskMgrMB.operator}" />
			</p:commandButton>
		</h:panelGrid>
		<p:dataTable id="dtTask" var="row" value="#{wfmTaskMgrMB.voList}"
			selectionMode="single" selection="#{wfmTaskMgrMB.selectedTask}" rowKey="#{row.id}"
			resizableColumns="true" liveResize="true" rows="10" paginator="true" paginatorPosition="bottom" >
			<p:column headerText="信息" style="width:32px">
				<p:commandButton icon="ui-icon-search"   title="详情"  
					action="#{wfmTaskMgrMB.viewInfoAction}"  update=":wfmTaskFrm :bmeTaskPanel :frmWfmTask :frmdDagram "  >
					<f:setPropertyActionListener value="#{row}"
						target="#{wfmTaskMgrMB.selectedTask}" />						
				</p:commandButton>	
			</p:column>	
				
			<p:column headerText="流程名称" style="width:100px;"
				sortBy="#{row.processDisplayName}" filterBy="#{row.processDisplayName}"	filterMatchMode="contains">
				<h:outputText value="#{row.processDisplayName}" />
			</p:column>
			<p:column headerText="业务编号" style="width:150px;"
				sortBy="#{row.serviceNo}" filterBy="#{row.serviceNo}"	filterMatchMode="contains">
				<h:outputText value="#{row.serviceNo}" />
			</p:column>
			<p:column headerText="任务编号" style="width:150px;"
				sortBy="#{row.id}" >
				<h:outputText value="#{row.id}" />
			</p:column>
			<p:column headerText="任务名称">
				<h:outputText value="#{row.displayName}" />
			</p:column>
			<p:column headerText="任务类型">
				<h:outputText value="#{row.taskType == 2 ? '协办任务' : '主办任务'}&nbsp;" />
			</p:column>
			<p:column headerText="参与类型">
				<h:outputText
					value="#{row.performType == 2 ? '会签任务' : '普通任务'}&nbsp;" />
			</p:column>
			<p:column headerText="创建时间">
				<h:outputText value="#{row.createTime}" />
			</p:column>
			<p:column headerText="参与者">
				<h:outputText value="#{row.operator}" />
			</p:column>
			<p:column headerText="过期时间">
				<h:outputText value="#{row.expireTime}" />
			</p:column>
		</p:dataTable>
	</h:form>
		
	<!-- 业务信息处理页面 -->
	<p:panel id="bmeTaskPanel" header="业务处理" >
		<ui:include src="#{wfmTaskMgrMB.uiTaskTodoPage}.xhtml" />
	</p:panel>
	
	<h:form id="frmWfmTask">
		<!-- 流程任务处理提交 -->							
		<p:panel id="taskPanel" header="流程处理" style="margin-bottom:5px" rendered="#{not empty wfmTaskMgrMB.selectedTask}">
			<h:panelGrid columns="4" cellspacing="10">
				<h:outputText value="任务编号" />
				<h:outputText value="#{wfmTaskMgrMB.selectedTask.id}" style="color:red;"/>
				<h:outputText value="任务名称" />
				<h:outputText value="#{wfmTaskMgrMB.selectedTask.displayName}" style="color:red;"/>

				<h:outputText value="处理结果" />
				<p:selectOneMenu value="#{wfmTaskMgrMB.workResult}"
					style="width:90%;" required="true" requiredMessage="服务类型必须输入">
					<f:selectItem itemLabel="正常完成" itemValue="0" />
					<f:selectItem itemLabel="异常处理" itemValue="1" />										
				</p:selectOneMenu>	
				<h:outputText value="回滚节点" />
				<p:selectOneMenu value="#{wfmTaskMgrMB.rollbackNode}" effect="fold" style="width:90%">
					<f:selectItem itemLabel="选择回滚节点" itemValue="" />
					<f:selectItems value="#{wfmTaskMgrMB.nodeList}" />
				</p:selectOneMenu>	
				<h:outputText value="处理结果信息" />
				<h:inputTextarea value="#{wfmTaskMgrMB.workRemarks}" cols="80" rows="6"/>
			
				<h:outputText value="附件上传" />
				<p:panel id="applexFile" 
					style="margin-bottom:5px" rendered="#{not empty wfmTaskMgrMB.selectedTask}">
					<h:panelGrid>
						<p:fileUpload fileUploadListener="#{wfmTaskMgrMB.handleFileUpload}"
							mode="advanced" dragDropSupport="false" invalidFileMessage="不合法的文件类型"
							label="附件选择" uploadLabel="文件上传" cancelLabel="取消上传"						
							update=":frmWfmTask:upresult"  sizeLimit="10000000" fileLimit="10"
							allowTypes="/(\.|\/)(gif|jpe?g|png|xml|snaker)$/" />
					</h:panelGrid>
					<h:outputText id="upresult" value="成功上传附件: #{wfmTaskMgrMB.uploadedFile} " style="color:blue;" />
				</p:panel>			
			</h:panelGrid>
			
			<p:commandButton value="提交流程任务" icon="ui-icon-check"
				action="#{wfmTaskMgrMB.commitTask}"
				update=":wfmTaskFrm :frmWfmTask :frmdDagram">
			</p:commandButton>		
			
		</p:panel>
	</h:form>	
	
	<h:form id="frmdDagram">
		<p:panel id="diagramPanel" header="流程图示" style="margin-bottom:1px" rendered="#{not empty wfmTaskMgrMB.selectedTask}">
			<p:diagram value="#{wfmTaskMgrMB.model}" style="height:400px" styleClass="ui-widget-content" />				
		</p:panel>	
	</h:form>
		
	</ui:define>
</ui:composition>

